# 彩票分析
# 创建一个名为my_ticket 的列表或元组，再编写一个循环，不断地随机选择数或字母，直到中大奖为止。请打印一条消息，报告执行循环多少次才中了大奖。

from random import choice

nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 'A', 'B', 'C', 'D', 'E']

prize_nums = []
for i in range(0, 4):
    prize_nums.append(choice(nums))

my_ticket = []
flag = False
count = 0

while not flag:

    for i in range(0, 4):
        my_ticket.append(choice(nums))

    if my_ticket[0] in prize_nums and my_ticket[1] in prize_nums and my_ticket[2] in prize_nums and my_ticket[3] in prize_nums:
        flag = True
    else:
        my_ticket = []
    
    count += 1

print(f"After looped {count} times, you finally win the first prize.\n{my_ticket}")
